package com.cashmama.market.api.infras.enums.error;

import com.fqgj.exception.enums.ErrorCodeEnum;
import org.springframework.http.HttpStatus;

/**
 * @Author frank
 * @Date 2017/8/1 0001 下午 9:57
 */
public enum ProductErrorCodeEnum implements ErrorCodeEnum {

    PRODUCT_NOT_EXIST(50001, "Product does not exist", HttpStatus.OK),
    PRODUCT_NOT_NORNAL(50002, "Invalid product", HttpStatus.OK),
    APP_PRODUCT_NOT_EXIST(50003, "The current app does not have this category product", HttpStatus.OK),
    CATEGORY_CODE_NOT_EXIST(50004, "When obtaining a loan combination, the category cannot be empty", HttpStatus.OK),
    APPCODE_EMPTY(50005,"appCode Can not be empty", HttpStatus.OK),
    CATEGORY_SIZE_LESS(50006,"The number of multi-category app categories is too small", HttpStatus.BAD_REQUEST),
    CATEGORY_EMPTY(50007,"Product category cannot be empty", HttpStatus.BAD_REQUEST);

    private Integer code;
    private String desc;
    private HttpStatus httpStatus;

    ProductErrorCodeEnum(Integer code, String desc, HttpStatus httpStatus) {
        this.code = code;
        this.desc = desc;
        this.httpStatus = httpStatus;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /****
     * 错误信息
     * @return
     */
    @Override
    public String getMsg(){
        return desc;
    }

    @Override
    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    public void setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }
}
